package com.project.seckill.bo;

/**
 * Created by yachao on 2018/6/24.
 */
public abstract class AbstractKeyPrefix implements KeyPrefix {

    private int expireSeconds;
    private String prefix;

    public AbstractKeyPrefix(String prefix) {
        this(0, prefix);
    }

    public AbstractKeyPrefix(int expireSeconds, String prefix) {
        this.expireSeconds = expireSeconds;
        this.prefix = prefix;
    }

    @Override
    public int expireSeconds() {
        return expireSeconds;
    }

    @Override
    public String getPrefix() {
        String className = this.getClass().getSimpleName();
        return className + ":" + prefix;
    }
}
